69 turkey earthquake
Visualizing Maxar Open Data for the 2023 Turkey-Syria Earthquake
The Maxar Open Data Program provides pre- and post-event high-resolution satellite imagery in support of emergency planning, risk assessment, monitoring of staging areas and emergency response, damage assessment, and recovery. Check out the links below for more information.
- Maxar Open Data Program
- Maxar Open Data on AWS
- Maxar Open Data on STAC Index
- Maxar Open Data on STAC Browser
- Maxar Open Data in CSV, GeoJSON, and MosaicJSON formats
This notebook shows how to visualize and download the Maxar Open Data for the 2023 Turkey Earthquake using leafmap.
First, install libraries and import modules.
# !pip install -U leafmap geopandas
import leafmap
import geopandas as gpd
Retrieve all collections from the Maxar Open Data STAC catalog. Each collection represents a single event.
leafmap.maxar_collections()
['Gambia-flooding-8-11-2022', 'Hurricane-Fiona-9-19-2022', 'Hurricane-Ian-9-26-2022', 'Indonesia-Earthquake22', 'Kahramanmaras-turkey-earthquake-23', 'New-Zealand-Flooding22', 'New-Zealand-Flooding23', 'Sudan-flooding-8-22-2022', 'afghanistan-earthquake22', 'cyclone-emnati22', 'kentucky-flooding-7-29-2022', 'pakistan-flooding22', 'southafrica-flooding22', 'tonga-volcano21', 'volcano-indonesia21', 'yellowstone-flooding22']
The collection ID for the 2023 Turkey Earthquake is Kahramanmaras-turkey-earthquake-23. We can get the footprints (geojson, tsv) of the event from the Maxar Open Data GitHub repo:
collection = 'Kahramanmaras-turkey-earthquake-23'
url = leafmap.maxar_collection_url(collection, dtype='geojson')
url
'https://raw.githubusercontent.com/giswqs/maxar-open-data/master/datasets/Kahramanmaras-turkey-earthquake-23.geojson'
Let's find out how many images are available for the event:
gdf = gpd.read_file(url)
print(f'Total number of images: {len(gdf)}')
gdf.head()
Total number of images: 2024
| datetime | platform | gsd | ard_metadata_version | catalog_id | utm_zone | quadkey | view:off_nadir | view:azimuth | view:incidence_angle | view:sun_azimuth | view:sun_elevation | proj:epsg | grid:code | proj:bbox | tile:data_area | tile:clouds_area | tile:clouds_percent | visual | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230322 | 29.4 | 22.0 | 57.4 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230322 | 600452.7792440292,4199843.75,605156.25,4204327... | 20.8 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.19672 37.94010, 40.14382 37.94062... |
| 1 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230323 | 29.3 | 21.3 | 57.6 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230323 | 604843.75,4199843.75,610156.25,4204393.030737486 | 23.9 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.25361 37.93950, 40.19317 37.94013... |
| 2 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230332 | 29.1 | 20.6 | 57.8 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230332 | 609843.75,4199843.75,615155.9736693815,4204458... | 24.1 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.25006 37.93954, 40.25075 37.98047... |
| 3 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230333 | 29.1 | 20.3 | 57.8 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230333 | 614843.75,4199843.75,615155.9736693815,4204458... | 1.2 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.30694 37.93892, 40.30768 37.98047... |
| 4 | 2021-02-28 08:10:23+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020232100 | 29.4 | 21.8 | 57.4 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020232100 | 600503.194703785,4194843.75,605156.25,4200156.25 | 24.5 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.19677 37.94291, 40.19599 37.89504... |
Visualize the footprints of the images on the map:
m = leafmap.Map()
m.add_gdf(gdf, layer_name='Footprints')
m
The earthquake started on February 6, 2023. We can use the start_date and end_date parameters to filter the images by date. Set end_date to 2023-02-06 to get all images captured before the earthquake:
pre_gdf = leafmap.maxar_search(collection, end_date='2023-02-06')
print(f'Total number of pre-event images: {len(pre_gdf)}')
pre_gdf.head()
Total number of pre-event images: 229
| datetime | platform | gsd | ard_metadata_version | catalog_id | utm_zone | quadkey | view:off_nadir | view:azimuth | view:incidence_angle | view:sun_azimuth | view:sun_elevation | proj:epsg | grid:code | proj:bbox | tile:data_area | tile:clouds_area | tile:clouds_percent | visual | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230322 | 29.4 | 22.0 | 57.4 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230322 | 600452.7792440292,4199843.75,605156.25,4204327... | 20.8 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.19672 37.94010, 40.14382 37.94062... |
| 1 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230323 | 29.3 | 21.3 | 57.6 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230323 | 604843.75,4199843.75,610156.25,4204393.030737486 | 23.9 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.25361 37.93950, 40.19317 37.94013... |
| 2 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230332 | 29.1 | 20.6 | 57.8 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230332 | 609843.75,4199843.75,615155.9736693815,4204458... | 24.1 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.25006 37.93954, 40.25075 37.98047... |
| 3 | 2021-02-28 08:10:22+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020230333 | 29.1 | 20.3 | 57.8 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020230333 | 614843.75,4199843.75,615155.9736693815,4204458... | 1.2 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.30694 37.93892, 40.30768 37.98047... |
| 4 | 2021-02-28 08:10:23+00:00 | WV03 | 0.39 | 0.0.1 | 1040010067C49900 | 37 | 120020232100 | 29.4 | 21.8 | 57.4 | 153.1 | 40.6 | 32637 | MXRA-Z37-120020232100 | 600503.194703785,4194843.75,605156.25,4200156.25 | 24.5 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((40.19677 37.94291, 40.19599 37.89504... |
Set the start_date to 2023-02-06 to get all images captured after the earthquake:
post_gdf = leafmap.maxar_search(collection, start_date='2023-02-06')
print(f'Total number of post-event images: {len(post_gdf)}')
post_gdf.head()
Total number of post-event images: 1795
| datetime | platform | gsd | ard_metadata_version | catalog_id | utm_zone | quadkey | view:off_nadir | view:azimuth | view:incidence_angle | view:sun_azimuth | view:sun_elevation | proj:epsg | grid:code | proj:bbox | tile:data_area | tile:clouds_area | tile:clouds_percent | visual | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 229 | 2023-02-07 08:27:01+00:00 | WV03 | 0.31 | 0.0.1 | 1040010082698700 | 37 | 031133010300 | 5.7 | 180.5 | 83.8 | 156.3 | 34.2 | 32637 | MXRA-Z37-031133010300 | 284307.55615234375,4134843.75,285156.25,413773... | 2.3 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.56529 37.36127, 36.57405 37.36116... |
| 230 | 2023-02-07 08:27:01+00:00 | WV03 | 0.31 | 0.0.1 | 1040010082698700 | 37 | 031133010301 | 5.7 | 181.3 | 83.8 | 156.3 | 34.2 | 32637 | MXRA-Z37-031133010301 | 284843.75,4134843.75,290156.25,4137711.7919921875 | 14.8 | 0.1 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.57052 37.36120, 36.57135 37.33537... |
| 231 | 2023-02-07 08:27:01+00:00 | WV03 | 0.31 | 0.0.1 | 1040010082698700 | 37 | 031133010310 | 5.7 | 186.0 | 83.7 | 156.3 | 34.2 | 32637 | MXRA-Z37-031133010310 | 289843.75,4134843.75,295156.25,4137567.7490234375 | 14.2 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.62697 37.36105, 36.62774 37.33652... |
| 232 | 2023-02-07 08:27:01+00:00 | WV03 | 0.31 | 0.0.1 | 1040010082698700 | 37 | 031133010311 | 5.8 | 188.8 | 83.7 | 156.3 | 34.2 | 32637 | MXRA-Z37-031133010311 | 294843.75,4134843.75,297504.8828125,4137500.61... | 6.9 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.68693 37.36163, 36.69621 37.36150... |
| 233 | 2023-02-07 08:27:02+00:00 | WV03 | 0.31 | 0.0.1 | 1040010082698700 | 37 | 031133010302 | 5.7 | 180.6 | 83.7 | 156.3 | 34.2 | 32637 | MXRA-Z37-031133010302 | 284180.908203125,4129843.75,285156.25,4135156.25 | 4.8 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.56530 37.33806, 36.57478 37.33826... |
Visualize the pre-event and post-event image footprints on the map. The red footprints represent the pre-event images and the blue footprints represent the post-event images:
m = leafmap.Map()
pre_style = {'color': 'red', 'fillColor': 'red', 'opacity': 1, 'fillOpacity': 0.5}
m.add_gdf(pre_gdf, layer_name='Pre-event', style=pre_style, info_mode='on_click')
m.add_gdf(post_gdf, layer_name='Post-event', info_mode='on_click')
m
Use the draw tools to select a region of interest (ROI) and get the bounding box coordinates:
bbox = m.user_roi_bounds()
if bbox is None:
bbox = [36.8715, 37.5497, 36.9814, 37.6019]
The folium plotting backend does not support this function.
Search the Maxar Open Data catalog for images within the ROI before the earthquake:
pre_event = leafmap.maxar_search(collection, bbox=bbox, end_date='2023-02-06')
pre_event.head()
| datetime | platform | gsd | ard_metadata_version | catalog_id | utm_zone | quadkey | view:off_nadir | view:azimuth | view:incidence_angle | view:sun_azimuth | view:sun_elevation | proj:epsg | grid:code | proj:bbox | tile:data_area | tile:clouds_area | tile:clouds_percent | visual | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 98 | 2022-07-26 08:19:46+00:00 | WV02 | 0.54 | 0.0.1 | 10300100D797E100 | 37 | 031131233232 | 23.2 | 143.9 | 63.7 | 130.7 | 65.1 | 32637 | MXRA-Z37-031131233232 | 314738.45123535924,4159843.75,315156.25,416316... | 1.2 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.90702 37.56709, 36.90229 37.56701... |
| 99 | 2022-07-26 08:19:46+00:00 | WV02 | 0.54 | 0.0.1 | 10300100D797E100 | 37 | 031131233233 | 23.1 | 144.6 | 63.9 | 130.7 | 65.1 | 32637 | MXRA-Z37-031131233233 | 314843.75,4159843.75,319758.3041869086,4163163... | 15.9 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.90348 37.56703, 36.90264 37.59693... |
| 100 | 2022-07-26 08:19:46+00:00 | WV02 | 0.54 | 0.0.1 | 10300100D797E100 | 37 | 031133011010 | 23.1 | 143.8 | 63.9 | 130.7 | 65.1 | 32637 | MXRA-Z37-031133011010 | 314714.4264589311,4158758.460866644,315156.25,... | 0.5 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.90694 37.56991, 36.90729 37.55732... |
| 101 | 2022-07-26 08:19:46+00:00 | WV02 | 0.54 | 0.0.1 | 10300100D797E100 | 37 | 031133011011 | 22.9 | 144.5 | 64.1 | 130.7 | 65.1 | 32637 | MXRA-Z37-031133011011 | 314843.75,4158659.1890106304,319695.2811615013... | 6.9 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.90340 37.56984, 36.95831 37.57081... |
Search the Maxar Open Data catalog for images within the ROI after the earthquake:
post_event = leafmap.maxar_search(collection, bbox=bbox, start_date='2023-02-06')
post_event.head()
| datetime | platform | gsd | ard_metadata_version | catalog_id | utm_zone | quadkey | view:off_nadir | view:azimuth | view:incidence_angle | view:sun_azimuth | view:sun_elevation | proj:epsg | grid:code | proj:bbox | tile:data_area | tile:clouds_area | tile:clouds_percent | visual | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 435 | 2023-02-08 09:02:04+00:00 | WV02 | 0.78 | 0.0.1 | 10300500D9F8D200 | 37 | 031131233232 | 40.2 | 273.1 | 43.6 | 166.6 | 36.6 | 32637 | MXRA-Z37-031131233232 | 309843.75,4159843.75,315156.25,4165156.25 | 28.2 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.84552 37.61386, 36.84690 37.56601... |
| 436 | 2023-02-08 09:02:04+00:00 | WV02 | 0.79 | 0.0.1 | 10300500D9F8D200 | 37 | 031131233233 | 40.4 | 273.1 | 43.4 | 166.6 | 36.6 | 32637 | MXRA-Z37-031131233233 | 314843.75,4159843.75,320156.25,4165156.25 | 28.2 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.90214 37.61488, 36.90348 37.56703... |
| 439 | 2023-02-08 09:02:04+00:00 | WV02 | 0.79 | 0.0.1 | 10300500D9F8D200 | 37 | 031131233322 | 40.6 | 273.1 | 43.1 | 166.6 | 36.6 | 32637 | MXRA-Z37-031131233322 | 319843.75,4159843.75,325156.25,4165156.25 | 28.2 | 0.0 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.95876 37.61588, 36.96006 37.56802... |
| 446 | 2023-02-08 09:02:04+00:00 | WV02 | 0.78 | 0.0.1 | 10300500D9F8D200 | 37 | 031133011010 | 40.3 | 273.3 | 43.6 | 166.6 | 36.7 | 32637 | MXRA-Z37-031133011010 | 309843.75,4154843.75,315156.25,4160156.25 | 28.2 | 0.5 | 1 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.84682 37.56883, 36.84820 37.52098... |
| 447 | 2023-02-08 09:02:04+00:00 | WV02 | 0.79 | 0.0.1 | 10300500D9F8D200 | 37 | 031133011011 | 40.5 | 273.3 | 43.3 | 166.6 | 36.7 | 32637 | MXRA-Z37-031133011011 | 314843.75,4154843.75,320156.25,4160156.25 | 28.2 | 0.1 | 0 | https://maxar-opendata.s3.amazonaws.com/events... | POLYGON ((36.90340 37.56984, 36.90474 37.52199... |
Get the catalog id of the pre-event tile, which contain several images. Each of the image has a unique quadkey:
pre_tile = pre_event['catalog_id'].values[0]
pre_tile
'10300100D797E100'
Get the catalog id of the post-event tile, which contain several images. Each of the image has a unique quadkey:
post_tile = post_event['catalog_id'].values[0]
post_tile
'10300500D9F8D200'
Get the MosaicJSON for the pre-event tile:
pre_stac = leafmap.maxar_tile_url(collection, pre_tile, dtype='json')
pre_stac
'https://raw.githubusercontent.com/giswqs/maxar-open-data/master/datasets/Kahramanmaras-turkey-earthquake-23/10300100D797E100.json'
Get the MosaicJSON for the post-event tile:
post_stac = leafmap.maxar_tile_url(collection, post_tile, dtype='json')
post_stac
'https://raw.githubusercontent.com/giswqs/maxar-open-data/master/datasets/Kahramanmaras-turkey-earthquake-23/10300500D9F8D200.json'
Create a split map to compare the pre-event and post-event images. Note the the ipyleaflet split map has some bugs (source), so we will use the folium plotting backend instead.
import leafmap.foliumap as leafmap
m = leafmap.Map()
m.split_map(
left_layer=pre_stac,
right_layer=post_stac,
left_label='Pre-event',
right_label='Post-event',
)
m.set_center(36.9265, 37.5762, 16)
m
Get download links for the pre-event and post-event images:
pre_images = pre_event['visual'].tolist()
post_images = post_event['visual'].tolist()
Download the pre-event and post-event images:
leafmap.maxar_download(pre_images)
Downloading 1 out of 4: 10300100D797E100/031131233232.tif
Downloading... From: https://maxar-opendata.s3.amazonaws.com/events/Kahramanmaras-turkey-earthquake-23/ard/37/031131233232/2022-07-26/10300100D797E100-visual.tif To: /home/runner/work/leafmap/leafmap/docs/notebooks/10300100D797E100/031131233232.tif 100%|██████████| 7.01M/7.01M [00:00<00:00, 38.5MB/s]
Downloading 2 out of 4: 10300100D797E100/031131233233.tif
Downloading... From: https://maxar-opendata.s3.amazonaws.com/events/Kahramanmaras-turkey-earthquake-23/ard/37/031131233233/2022-07-26/10300100D797E100-visual.tif To: /home/runner/work/leafmap/leafmap/docs/notebooks/10300100D797E100/031131233233.tif 100%|██████████| 52.3M/52.3M [00:01<00:00, 43.7MB/s]
Downloading 3 out of 4: 10300100D797E100/031133011010.tif
Downloading... From: https://maxar-opendata.s3.amazonaws.com/events/Kahramanmaras-turkey-earthquake-23/ard/37/031133011010/2022-07-26/10300100D797E100-visual.tif To: /home/runner/work/leafmap/leafmap/docs/notebooks/10300100D797E100/031133011010.tif 100%|██████████| 4.16M/4.16M [00:00<00:00, 24.8MB/s]
Downloading 4 out of 4: 10300100D797E100/031133011011.tif
Downloading... From: https://maxar-opendata.s3.amazonaws.com/events/Kahramanmaras-turkey-earthquake-23/ard/37/031133011011/2022-07-26/10300100D797E100-visual.tif To: /home/runner/work/leafmap/leafmap/docs/notebooks/10300100D797E100/031133011011.tif 100%|██████████| 20.4M/20.4M [00:00<00:00, 35.8MB/s]
# leafmap.maxar_download(post_images)
Created: 2023-03-05